<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/jsp/cortop.jsp"%>
<%@ include file="/jsp/jscommom.jsp"%>
<%@ include file="/jsp/viewtop.jsp"%>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<title>新增职位</title>
		<link href="/css/login.css" rel="stylesheet" type="text/css" />
	</head>
	<script type="text/javascript" src="/js/prototype-1.5.1.2.js"></script>
	<script language="javascript">

<bean:write name="com_struts_web_corpor_manage_infomanage_AddPoForm" property="printStaSql" filter="false"/>


//定义一个变量用于存放XMLHttpRequest对象
	var xmlHttp1; 
	
	//该函数用于创建一个xmlHttp1Request对象
	function createXMLHttpRequest() {
		if (window.ActiveXObject) {
			xmlHttp1 = new ActiveXObject("Microsoft.XMLHTTP");
		} 
		else if (window.XMLHttpRequest) {
			xmlHttp1 = new XMLHttpRequest();
		}
	}

	
	//这是响应列表的onChange事件的处理方法
	function updateSelect(){
		var selected = document.all.stations.value;//
		//创建一个XMLHttpRequest对象
		createXMLHttpRequest();
		
		//通过GET方法向指定的URL建立服务器的调用
		xmlHttp1.open("GET", "/SubStationXML?selected="+selected,true);
		//将状态触发器绑定到一个函数
		xmlHttp1.onreadystatechange = processor;
		//发送请求
		xmlHttp1.send(null);
	}
	
	//处理从服务器返回的XML文档并更新列表
	function processor() {
		//定义一个变量用于存放从服务器返回的响应结果
		var result;
		if(xmlHttp1.readyState == 4) { //如果响应完成
			if(xmlHttp1.status == 200) {//如果返回成功
				//取出服务器返回的XML文档的所有标签的子节点
				result = xmlHttp1.responseXML.getElementsByTagName("sub");
				//先清除列表的现有内容
				while (document.all.subStation.options.length>0){
					document.all.subStation.removeChild(document.all.subStation.childNodes[0]);
				}
				//解析XML中的数据并更新
				for(var i=0;i<result.length;i++){
					var option = document.createElement("OPTION");
					option.text = result[i].childNodes[0].childNodes[0].nodeValue;//这就是取出值
					option.value = result[i].childNodes[1].childNodes[0].nodeValue;//这就是取出值
					document.all.subStation.options.add(option);//为岗位列表添加
				}
			}
		}
	}
	
	function doadd(){
	
	   if(document.all.positionName.value==""){
	      alert("对不起,职位名称不能为空!");
	      return;
	   }
	   if(document.all.startIssueDate.value=="" || document.all.endIssueDate.value==""){
	      alert("对不起,招聘日期不能为空!");
	      return;
	   }
	   if(document.all.requirement.value==""){
	      alert("对不起,职位要求不能为空!");
	      return;
	   }
	   document.all.method.value="add";
	   document.forms[0].submit();
	   document.all.method.value="";
	
	}
</script>
	<body>
		<html:javascript
			formName="com_struts_web_corpor_manage_infomanage_AddPoForm" />
		<html:form action="/com/corpor/manage/addpo" method="post"
			onsubmit="return validateCom_struts_web_corpor_manage_infomanage_AddPoForm(this);">
			<html:hidden property="method" />
			<div align="center">
				<table width="880" border="0" align="center" cellpadding="0"
					cellspacing="1" class="line1">
					<tr>
						<td class="titlebg" colspan="2">
							新增职位
						</td>
					</tr>

					<tr>
						<td class="mtdtitle1">
							*工作岗位:
						</td>
						<td class="mtdtextleft">
							<html:select property="stations" 
								styleClass="input1">
								<SCRIPT language="JavaScript">
			        for (var i = 0; i < (station.length); i++) {
			         document.write("<OPTION value='"+station[i]+"'");
			    document.write(">" + station[++i]+"</OPTION>");	
			  }
			</SCRIPT>
							</html:select>
							－
							<html:text property="subStation" styleClass="input1"></html:text>
						</td>
					</tr>

					<tr>
						<td class="mtdtitle1">
							*职位名称:
						</td>
						<td class="mtdtextleft">
							<html:text property="positionName" styleClass="input1"></html:text>
						</td>
					</tr>

					<tr>
						<td class="mtdtitle1">
							*招聘时间:
						</td>
						<td class="mtdtextleft">
							从
							<html:text property="startIssueDate" onclick="datepopup(this)"
								styleClass="input1"></html:text>
							到
							<html:text styleClass="input1" property="endIssueDate"
								onclick="datepopup(this)"></html:text>
						</td>
					</tr>
                     <!--  
					<tr>
						<td class="mtdtitle1">
							*职位描述:
						</td>
						<td class="mtdtextleft">
							<html:textarea property="descript" cols="100%"
								styleClass="input1"></html:textarea>
						</td>
					</tr>
					-->

					<tr>
						<td class="mtdtitle1">
							*职位要求:
						</td>
						<td class="mtdtextleft">
							<html:textarea property="requirement" cols="100%"
								styleClass="input1"></html:textarea>
						</td>
					</tr>

					<tr>
						<td class="mtdtitle1" colspan="2">
							<input type="button" class="tbutton" onclick="doadd()" value="提交" />
							<input type="reset" class="tbutton" value="重置" />
							<input type="button" class="tbutton" value="关闭"
								onclick="window.close();" />
						</td>
					</tr>
				</table>
			</div>
		</html:form>

	</body>
</html>
